package org.example.bean.enums;

import lombok.Getter;

@Getter
public enum HomeType {
    /**
     * 提交发货
     */
    SUBMIT(0, "提交发货"),
    /**
     * 待确认出售
     */
    CONFIRM(1, "待确认出售"),
    /**
     * 成交
     */
    SUCCESS(2, "成交"),
    /**
     * 拉新
     */
    PULL_NEW(3, "拉新"),
    /**
     * 买家付款
     */
    PAY(4, "买家竞得"),
    /**
     * 拍拍代卖发货
     */
    SELL_SEND(5, "拍拍代卖发货"),

    RETAIL_SYSTEM(6, "零售体系");

    private final Integer code;

    private final String description;

    HomeType(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public static HomeType ofCode(Integer code) {
        for (HomeType type : HomeType.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}
